#ifndef DBMANAGER_H
#define DBMANAGER_H

#include "DAL/dal.h"
extern Sqlite * bSqlite;
#include "misc.h"
#include <QDateTime>

class DBManager
{

public:
    static DBManager &getInstance();
    //用户表
    bool logon(MsgDatagram &msg);//用户注册
    bool checkLogin(MsgDatagram &msg);
    bool updateUserLogonStatus(QString phonenum,bool logonStatus);
    void updateAllUserLogonStatus(); //服务器断开时所有的客户端连接状态为未连接
    bool findUserPassword(MsgDatagram& msg);

    //队列表&&病人预约表
    //1.预约  //2.取消预约
    bool appointment(MsgDatagram& msg);
    bool cancelappointment(MsgDatagram &msg);
    int findOrderNum(QString orderType,QString phonenum);
    int findOrderNum(QString phonenum);
    QMap<QString,int> findAppointmentInformation(MsgDatagram &msg);
    QMap<QString,int> findOperationTypeCount();
    int findOperationTypeCount(QString operationType);



    //病人信息表
    bool updatePatientInfo(MsgDatagram &msg);
    QString findPatientName(QString phonenum);



    //腹内压数据

private:
    DBManager();


};

#endif // DBMANAGER_H
